package com.springcloud.control;

import com.api.HelloRemote;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
@RequestMapping("/hello")
public class HelloController implements HelloRemote {

    @Value("${server.port}")
    private String port;

    @GetMapping("/{name}")
    public String hello(@PathVariable String name) {
        return "WelCome " + name + " to port:" + port + " " + new Date();
    }

}
